﻿@using zichan.Common
@model zichan.Entity.Asset
@{
    ViewBag.Title = "详情";
}

@section Pagetitle{
    @AdminCommon.PageTitle("详情", "编辑")
}
@section header{
    <style>
        .control-label {
            text-align: right;
        }
    </style>
}
<div class="portlet-body form">
    <div class="form-body">
        @*<h2 class="margin-bottom-20"> 资产详情 </h2>*@
        <div class="row">
            <div class="col-md-6">
                <div class="col-md-12 form-section">
                    <div class="col-md-3">
                        <h3>基本信息</h3>
                    </div>
                    <div class="col-md-9" style="padding:10px;">
                        @if (PowerHelp.Check("RepertoryManage", "OutWareHouse") && Model.Status == 1)
                        {<a href="/RepertoryManage/OutWareHouse?id=@Model.Id" class="btn green">出库</a>}
                        @if (PowerHelp.Check("RepertoryManage", "Scrap") && Model.Status == 1)
                        {
                            <button class="btn blue" id="btn_scrap" data-assetId="@Model.Id">报废</button>}
                        @if (PowerHelp.Check("RepertoryManage", "PutWareHouse") && Model.Status == 2)
                        {
                            <a href="/RepertoryManage/PutWareHouse?id=@Model.Id" class="btn green">入库</a>
                        }
                        @if (PowerHelp.Check("RepertoryManage", "Index") && Model.Status != 3)
                        {
                            <a href="/RepertoryManage/Index" class="btn default">返回</a>
                        }
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label class="control-label col-md-3">资产分类:</label>
                        <div class="col-md-9">
                            @Model.AssetClassName
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label class="control-label col-md-3">资产状态:</label>
                        <div class="col-md-9">
                            @{
                                if (Model.Status == (int)AsseteStatu.Repertory)
                                {
                                    <span class='label label-sm label-warning'>库存</span>
                                }
                                if (Model.Status == (int)AsseteStatu.InUse)
                                {
                                    <span class='label label-sm label-warning'>使用中</span>
                                }
                                if (Model.Status == (int)AsseteStatu.Scrap)
                                {

                                    <span class='label label-sm label-warning'>报废</span>
                                }
                            }
                        </div>
                    </div>
                </div>
                <!--/span-->
                <div class="row">
                    <div class="form-group">
                        <label class="control-label col-md-3">所属公司:</label>
                        <div class="col-md-9">
                            @Model.CompanyName
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label class="control-label col-md-3">资产名称:</label>
                        <div class="col-md-9">
                            @Model.Name
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label class="control-label col-md-3">资产编号:</label>
                        <div class="col-md-9">
                            @Model.Code
                        </div>
                    </div>
                </div>
                <!--/span-->
                <!--/row-->
                <div class="row">
                    <div class="form-group">
                        <label class="control-label col-md-3">采购人:</label>
                        <div class="col-md-9">
                            @Model.BuyerName
                        </div>
                    </div>
                </div>
                <!--/span-->
                <div class="row">
                    <div class="form-group">
                        <label class="control-label col-md-3">采购时间:</label>
                        <div class="col-md-9">
                            @Model.BuyTime.ToShortDateString()
                        </div>
                    </div>
                </div>
                <!--/span-->
                <!--/row-->
                <div class="row">
                    <div class="form-group">
                        <label class="control-label col-md-3">资产所在地:</label>
                        <div class="col-md-9">
                            @Model.CalculatedGround
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label class="control-label col-md-3">接收人:</label>
                        <div class="col-md-9">
                            @Model.RecipientName
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label class="control-label col-md-3">供应商:</label>
                        <div class="col-md-9">
                            @Model.Supplier
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label class="control-label col-md-3">备注:</label>
                        <div class="col-md-9">
                            @Model.Remark
                        </div>
                    </div>
                </div>

            </div>
            @if (Model.AssetClassId == 1 && zichan.Common.PowerHelp.Check("RepertoryManage", "partServer_Details"))
            {
                @Html.Action("partServer_Details", new { id = Model.Id })
            }
            @if (Model.AssetClassId != 1 && zichan.Common.PowerHelp.Check("RepertoryManage", "part_Details"))
            {
                @Html.Action("part_Details", new { id = Model.Id })
            }
        </div>
        @if (zichan.Common.PowerHelp.Check("UsageLog", "Index"))
            {<div class="row">
            @Html.Action("Index", "UsageLog", new { id = Model.Id })
        </div>}
    </div>
   
</div>

@section footer{
    <script src="~/Scripts/layer/layer.js"></script>
    <script>
        $("#btn_scrap").on("click", function () {
            var id = $(this).attr("data-assetId");
            layer.open({
                type: 2,
                title: ['报废', 'font-size:18px;'],
                shade: [0.8, '#393D49'],
                area: ['500px', '350px'],
                scrollbar: false,
                maxmin: true,
                content: ['/RepertoryManage/Scrap?id=' + id, 'no'],
                zIndex: layer.zIndex, //重点1
                success: function (layero) {
                    layer.setTop(layero); //重点2
                }
            });
        });
    </script>
}
